From 5f3e1c0964dd324b14cb44e57f624e7614f391b0 Mon Sep 17 00:00:00 2001 From: tsteven4 Date: Wed, 8 Nov 2017 09:43:32 -0700 Subject: [PATCH] fix bug with nested batch files. --- main.cc | 2 +- testo.d/batch.test | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 testo.d/batch.test diff --git a/main.cc b/main.cc index 3ab7ffb88..6cf923cae 100644 --- a/main.cc +++ b/main.cc @@ -623,7 +623,7 @@ main(int argc, char* argv[]) break; } - if ((argn+1 >= argc) && (arg_stack != NULL)) { + while ((argn+1 >= argc) && (arg_stack != NULL)) { arg_stack = pop_args(arg_stack, &argn, &argc, &argv); } argn++; diff --git a/testo.d/batch.test b/testo.d/batch.test new file mode 100644 index 000000000..addaaba02 --- /dev/null +++ b/testo.d/batch.test @@ -0,0 +1,24 @@ + +# batch files + +rm -f ${TMPDIR}/batch0 +touch ${TMPDIR}/batch0 +echo "-b ${TMPDIR}/batch1" >> ${TMPDIR}/batch0 + +rm -f ${TMPDIR}/batch1 +touch ${TMPDIR}/batch1 +echo "-i gpx" >> ${TMPDIR}/batch1 +echo "-f ${REFERENCE}/bounds-test.gpx" >> ${TMPDIR}/batch1 +echo "-o kml" >> ${TMPDIR}/batch1 +echo "-F ${TMPDIR}/batch-bnds.kml" >> ${TMPDIR}/batch1 + +rm -f ${TMPDIR}/expected_version +gpsbabel -V 1>${TMPDIR}/expected_version + +rm -f ${TMPDIR}/batch-bnds.kml +gpsbabel -b ${TMPDIR}/batch0 -V 1>${TMPDIR}/batch_version +# if we don't pop all the way back to the original arugments we won't execute the -V +compare ${TMPDIR}/expected_version ${TMPDIR}/batch_version +# make sure we ran the innermosts batch file +compare ${REFERENCE}/bounds-test.kml ${TMPDIR}/batch-bnds.kml + -- 2.30.2